<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全局状态管理</title>
</head>
<body>
    <script type="module">
        import { createApp, reactive } from '../../public/petite-vue-module.js'
      
        const store = reactive({
          count: 0,
          inc() {
            this.count++
          }
        })
      
        // manipulate it here
        store.inc()
      
        createApp({
          // share it with app scopes
          store
        }).mount()
      </script>
      
      <div v-scope="{ localCount: 0 }">
        <p>Global {{ store.count }}</p>
        <button @click="store.inc">increment</button>
      
        <p>Local {{ localCount }}</p>
        <button @click="localCount++">increment</button>
      </div>
</body>
</html>